<template>
  <div class="error-list">
    <leave-crud title="告警历史" :url="url" :searchOption="searchOption" :cutOperation="['view', 'create', 'edit']">
      <template slot="tableRows">
        <el-table-column prop="title" label="告警标题"></el-table-column>
        <el-table-column prop="action.name" label="告警方式"></el-table-column>
        <el-table-column prop="point" label="告警数据">
          <template slot-scope="props">
            <el-popover
              placement="top-start"
              width="300"
              title="数据"
              trigger="hover">
              <div v-html="$jsonFormat(props.row.point)"></div>
              <el-tag size="mini" type="primary" slot="reference">查看</el-tag>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="server.name" label="服务器"></el-table-column>
        <el-table-column prop="user.name" label="用户"></el-table-column>
        <el-table-column prop="createdAt" label="创建时间" min-width="110px">
          <template slot-scope="props">
            {{ props.row.createdAt | date }}
          </template>
        </el-table-column>
      </template>
    </leave-crud>
  </div>
</template>


<script>
  export default {
    name: 'error-list',
    data() {
      return {
        url: '/error',
        searchOption: [
          {
            'key': 'title',
            'label': '告警标题',
          },
          {
            'key': 'action.name',
            'label': '告警名称',
          },
          {
            'key': 'server.name',
            'label': '服务器名称',
          },
          {
            'key': 'user.name',
            'label': '用户名',
          },
        ],
      }
    },
    methods: {
      // 模块过滤
      filterModule(value, row) {
        return row.module.includes(value)
      },
    },
    created() {},
  }
</script>


<style lang="scss">
  .error-list {
  }
</style>
